package com.jswlw.service.biz.impl;

import com.jswlw.dao.biz.IdCreatorMapper;
import com.jswlw.entity.biz.IdCreator;
import com.jswlw.service.biz.IdCreatorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 吴维斌 E-mail:wuweibin0817@163.com
 * @version 创建时间：${date} ${time}
 */
@Slf4j
@Service
public class IdCreatorServiceImpl implements IdCreatorService {
    @Autowired
    IdCreatorMapper mapper;

    @Override
    public void add(IdCreator idCreator) {
        mapper.insert(idCreator);
    }

    @Override
    public int fetch() {
        int id = mapper.fetch();
        mapper.deleteByPrimaryKey(id);
        return id;
    }
}
